package com.cheung.leetcode.normal;

import java.util.ArrayList;
import java.util.List;

public class LC079 {
    public static List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> result = new ArrayList<>();
        backtracking(nums, new ArrayList<>(), result);
        return result;
    }


    public static void backtracking(int[] nums, List<Integer> path, List<List<Integer>> result) {
        if (path.size() == 2) {
            result.add(new ArrayList<>(path));
        }

        for (int num : nums) {
            if (!path.contains(num)) {
                path.add(num);
                backtracking(nums, path, result);
                path.remove(path.size() - 1);
            }
        }
    }


    public static void main(String[] args) {
        int[] nums = {1, 2, 3};
        System.out.println(subsets(nums));
    }

}